<?php
// 前台教育物业管理模块
class XegcAction extends CommonAction {
	function _filter(&$map){
		//$map['id'] = array('egt',1);
		//当是POST方式时，不为空，则查询相应zjnd,为空则所有年度，不是POST方式提交则默认查询当年数据	
		if('POST'==$_SERVER['REQUEST_METHOD']){
			$map['zjnd'] = $_POST['nd']?array('eq',$_POST['nd']):array('eq',$_SESSION['searchND']);
			$_SESSION['searchND'] = $_POST['nd'];
		}elseif($_SESSION['searchND']>0){
			$map['zjnd'] = array('eq',$_SESSION['searchND']);
		}else{
			$map['zjnd'] = array('eq',date('Y'));
			$_SESSION['searchND'] = date('Y');
		}	
		
		if(0!=$_SESSION['dwid'])$map['dwid'] = array('eq',$_SESSION['dwid']);
		$map['xmmc|dwmc'] = array('like',"%".$_POST['keyword']."%");
	}
		
	function showSchoolList(){
		$model = new Model();
		$list = $model->query("select id,sName,sType from think_school order by sName");
		echo json_encode($list);
	}
	
	function edit() {
        $name = $this->getActionName();
        $model = M($name);
        $id = $_REQUEST [$model->getPk()];
		//$id = 0==$_SESSION['dwid']?$_REQUEST[$model->getPk()]:$_SESSION['dwid'];
		$id = $_REQUEST[$model->getPk()];
        $vo = $model->getById($id);
        $this->assign('vo', $vo);
        $this->display();
    }
	
}
?>